clear
clear all
cap log close

log using "log-files/2_Figure_A3.smcl", replace smcl

timer on 2

*------------*
* Figure A.3 *
*------------*
	* Figure A.3.a
	*-------------
		use "data/outputs/computo_verificadortrepdate_missingsatthend.dta", clear
		keep if trep_missing_date_verificador == 0

		local x = tc(20oct2019 19:40:57)
		local x2 = tc(20oct2019 20:06:59)

		* Binned data using binsreg
		binsreg mshare_so trep_date_verificador, savedata(temp) replace

		use "temp.dta", clear
		erase "temp.dta"

		local x = tc(20oct2019 19:40:57)
		local x2 = tc(20oct2019 20:06:59)

		format dots_x %tc
		twoway (scatter dots_fit dots_x, msize(vsmall) mcolor(midblue)), ///
			graphregion(color(white)) ///
			xsize(7) ysize(5.5) ///
			xlabel(`x2' `" "8:06 p.m. (95.6%)" "') ///
			ylabel(, angle(0) nogrid) ///
			yscale(range(.2 .63)) ///
			xline(`x2', lcolor(black) lpattern(dash)) ///
			ytitle("Average Incumbent (MAS) Vote Share") ///
			xtitle("Verification Time")
		graph export "outputs/generated/Figure_A3a.pdf", replace

	* Figure A.3.b
	*-------------
	use "data/outputs/computo_verificadortrepdate_nomissings.dta", clear

	rdplot mshare_so pcs_so, c(.9559054) binselect(es) ///
		graph_options(xsize(7) ysize(5.5) ///
			ytitle("Average Incumbent (MAS) Vote Share") ///
			xtitle("Proportion of Preliminary Vote Verified") ///
			graphregion(color(white)) legend(off) ///
			ylabel(.2(.1).6, angle(0) nogrid) ///
			xlabel(0  .956  1 ))
		graph export "outputs/generated/Figure_A3b.pdf", replace

*------------------------------------------------------------------------------*
timer off 2
timer list 2

log close
clear all
